<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        function answer(){
            //按元素id找到元素对象
            var spanObj = document.getElementById("infoSpan");
            //设置元素标签中间的内容
            spanObj.innerHTML = "两头牛";
            //给元素添加样式
            spanObj.style.color = "red";
            //如果样式中有-。则去掉-，采用驼峰命名
            spanObj.style.backgroundColor = "yellow";
        }
    </script>
</head>
<body>
    <input type="button" value="一头公牛加一头母牛是哪三个字？" onclick="answer()">
    <span id="infoSpan"></span>

</body>
</html>